<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>上元每日出勤打卡click in、out</title>
</head>

<style>
    *{
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    #app{
        width: 1200px;
        height: 980px;
        margin: 0 auto;
        border:1px solid;
        text-align: center;
    }
    .box{
        display: flex;
        flex-flow: row wrap;
    }
    .box div{
        border: 1px solid blue;
        margin: 5px;
    }
</style>

      
<body>

    <div id="app">
        <!-- <div class="container"> -->
            <!-- <h1>{{responseData.className}}</h1> -->
            <!-- <img src="http://file.233863.com/upload/20210131/84b23fc37492432f81bcf148030ae84f.png" alt=""> -->
            <!-- <span>{{responseData.classCalers.teachName}}</span> -->
            <!-- <div class="box">
                <div v-for="item in responseData.classCalers">
                    <p>{{item.techDate}}</p>
                    <p>{{item.stuSignNum?'打卡完成':'未打卡'}}</p> -->
                    <!-- 传送后端的数据 -->
                    <!-- <p>{{item.calerId}}</p>
                </div>
            </div>
            
        </div> -->
        <button @click="getData">获取数据</button>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
 

    <script>

 




        var app = new Vue({
            el:"#app",
            data:{
                token:[],
                token1:"",
                responseData:[],
                person:{
                        'username':"18362505634",
                        'passwd':"wzx970210"
                },
                personalInfo:[
                    {
                        // personalName:"马腾",
                        'username':"13032534360",
                        'passwd':"Marshal991010"
                    },
                    {
                        // personalName:"傅运龙",
                        'username':"18667184527",
                        'passwd':"fly940106"
                    },
                    {
                        // personalName:"王镇潇",
                        'username':"18362505634",
                        'passwd':"wzx970210"
                    },
                    {
                        // personalName:"熊智忍",
                        'username':"18705236370",
                        'passwd':"xzr990510"
                    },
                    // {
                    //     personalName:"朱晓婷",
                    //     'username':"fly940106",
                    //     'passwd':"18667184527"
                    // },
                    {
                        // personalName:"周琪",
                        'username':"18379408224",
                        'passwd':"sy123456"
                    },
                    {
                        // personalName:"钱雁月",
                        'username':"13222422637",
                        'passwd':"sy123456"
                    },
                    
                    // {
                    //     personalName:"钱程",
                    //     'username':"fly940106",
                    //     'passwd':"18667184527"
                    // },
                    // {
                    //     personalName:"段谟峰",
                    //     'username':"fly940106",
                    //     'passwd':"18667184527"
                    // },
                    // {
                    //     personalName:"房鹏振",
                    //     'username':"fly940106",
                    //     'passwd':"18667184527"
                    // },
                    // {
                    //     personalName:"储森涛",
                    //     'username':"fly940106",
                    //     'passwd':"18667184527"
                    // },
                    // {
                    //     personalName:"陈明",
                    //     'username':"fly940106",
                    //     'passwd':"18667184527"
                    // },
                ],
            },
            created() {
                // 初始化登录获取后端返回的token值
                // this.personalInfo.forEach((obj,index) => {    
                    axios.post('https://gate.shangyuanjiaoyu.com/oluc/v1/login/simple', 
                    this.person).then(function (response) { 
                        // 
                        // 每次登录获取的token值都覆盖上一次的
                        // app.token.push(response);
                        app.token1=response.data.data.token;
                        console.log(response);
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                // });
            },
            methods: {
                getData(){
                    
                    axios.interceptors.request.use(function(config){
                            config.headers.Authorization = app.token1;
                            return config;
                        });
               
             
                    axios.post('https://gate.shangyuanjiaoyu.com/olprod/v1/personal/caler/sign',{"calerId":157837236568166 }).then(response=>{
                        console.log(response);
                    })



                    // 先获取后端每天打卡的记录

                    // 进行判断，如果已经打卡，则不需要进行重复打卡
                    // 设置请求头中的token
                    // console.log(this.token.length);
                    // this.token.forEach((item,index)=>{
                        
                    //     axios.interceptors.request.use(function(config){
                    //         config.headers.Authorization = item.data.data.token;
                    //         return config;
                    //     });
                        // 获取个人打卡信息接口数据
                        // axios.post('https://gate.shangyuanjiaoyu.com/olprod/v1/personal/class/query',{"classId": "157837234470913"}).then(response=>{
                        //     app.responseData.splice(index,1,response.data.data);
                        //     console.log(index+"---------------");
                        //     console.log(response);
                        //获取当天的打卡记录事件
                        // var d = new Date();
                        // var day = d.getDate();
                        // var month = d.getMonth() + 1;
                        // var year = d.getFullYear();
                        // day=day<10?'0'+day:day;
                        // month=month<10?'0'+month:month;
                        // let time = year+"-"+month+"-"+day;
                        // response.data.data.classCalers.forEach((item,index)=>{
                        //         if(item.techDate===time){
                        //             // 打卡需要提交的数据
                        //             console.log(item.calerId);
                        //             // 打卡是否完成
                        //             console.log(item.stuSignNum);
                        //             let calerId = item.calerId-1;
                        //             let stuSignNum=item.stuSignNum;
                        //             if(stuSignNum!==1){
                                        // axios.post('https://gate.shangyuanjiaoyu.com/olprod/v1/personal/caler/sign',{"calerId":157837236568162 }).then(response=>{
                                        //     // this.responseData=response.data.data;
                                        //     console.log(response.data.data);
                                        // })
                        //             }
                        //         }
                        //     })
                    //     })
                    // })
                    // console.log("----------------------");
                    // axios.post('https://gate.shangyuanjiaoyu.com/olprod/v1/personal/prod/query',{}).then(response=>{
                    //     this.responseData=response.data;
                    //     console.log(response);
                    // })
                    // 打卡接口
                    // axios.post('https://gate.shangyuanjiaoyu.com/olprod/v1/personal/caler/sign',{"calerId": "157837236568159"}).then(response=>{
                    //     this.responseData=response.data.data;
                    //     console.log(response.data.data);
                    // })

                }
            },

        })
     






      


        


        


            /* 
            登录的接口https://gate.shangyuanjiaoyu.com/oluc/v1/login/simple
            {
            "retcode": 200,
            "msg": "请求成功",
            "data": {
                "uid": "156385579565057",
                "wxAuthed": 1,
                "cateId": "2059",
                "passAuthed": 1,
                "cateName": "淘宝电商",
                "username": "18667184527",
                "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNTYzODU1Nzk1NjUwNTciLCJpYXQiOjE2MjcyMDY0MTQsImV4cCI6MTYyNzgxMTIxNH0.FlaWXdHCLVBzuVMlNJUpV-9JegMsq2fXYxkdkNr5CFSqSD9kZ3HJWdA0xtznug_-UXqF8H2U1o02GFxxTWmsyg"
            }
            }
            
            打卡接口
            https://gate.shangyuanjiaoyu.com/olprod/v1/personal/caler/sign


            忘记签到的接口
            https://gate.shangyuanjiaoyu.com/olprod/v1/personal/caler/forget/query
            个人信息的接口
            https://gate.shangyuanjiaoyu.com/oluc/v1/user/info/query
            获取个人阶段课程的接口
            https://gate.shangyuanjiaoyu.com/olprod/v1/personal/prod/query

            获取阶段课程每天的情况数据
            {
            "classId": "157837234470913"
            }
            https://gate.shangyuanjiaoyu.com/olprod/v1/personal/class/query
            
            */
    </script>





   
</body>

</html>